package com.gg.user.gguser.controller;

import com.gg.user.gguser.service.StaffService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

/**
 * @author yangxinlei
 * @date 2020/4/19
 */

@RestController
@RequestMapping("/staff")
public class StaffController {

    @Autowired
    private StaffService staffService;


    /**
     * 获取用户列表
     *
     * role 用户类型
     *
     * page 页面页数
     * pageNumer 每页个数
     *
     */
    @GetMapping("getUserStaff")
    public Object getUserStaff(HttpServletResponse response, HttpServletRequest request, Integer page, Integer pageNumber) throws Exception{
        return staffService.getUserStaff(response,request,page,pageNumber);
    }

    /**
     * 状态修改
     * @param response
     * @param request
     * @param status  现在状态
     * @return
     * @throws Exception
     */
    @GetMapping("setStatus")
    public Object setStatus(HttpServletResponse response, HttpServletRequest request, Integer status,String userId) throws Exception{
        return staffService.setStatus(response,request,status,userId);
    }


    /**
     * 修改密码
     * @param response
     * @param request
     * @param userId  用户id
     * @param userPassWord  修改的密码
     * @return
     * @throws Exception
     */
    @GetMapping("updatePassWord")
    public Object updatePassWord(HttpServletResponse response, HttpServletRequest request, String userId,String userPassWord) throws Exception{
        return staffService.updatePassWord(response,request,userId,userPassWord);
    }

    /**
     *用户个人中心修改东西
     * @param response
     * @param request
     * @param type      修改类型
     * @param content   修改内容
     * @return
     * @throws Exception
     */
    @GetMapping("userUpdatePersonal")
    public Object userUpdatePersonal(HttpServletResponse response, HttpServletRequest request, Integer type,String content) throws Exception{
        return staffService.userUpdatePersonal(response,request,type,content);
    }
}
